<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <#include "/pubHeadStyle.html">
</head>
<body>
<div class="formPreview layui-form" id="printFormPreview">

</div>


<script>

    layui.config({
        base: serverPath.formPath + staticPath.formPath //静态资源所在路径
    }).extend({
        index: 'index' //主入口模块
    }).use(['index', 'setter','ice','form','element','layer','slider','colorpicker','form','table','totalFilter','propsHandle'], function () {


        // -----常量声明----------
        var $ = layui.$,
            setter = layui.setter,  // 配置信息
            layer = layui.layer,
            ice = layui.ice,
            propsHandle = layui.propsHandle,
            form = layui.form,
            printTemplateId='${printTemplateId}' || '',
            defProps = {
                //viewMould: 'form/formDef/view/formDesign/moulds/', // 组件模块 存放文件 *****
                viewMould: 'moulds/', // 组件模块 存放文件 *****
                initCss:[
                    'style/forms/grid/grid1',
                    'style/forms/grid/grid2',
                    'style/forms/grid/grid3',
                    'style/forms/template/tag',
                    'style/forms/template/text',
                    'style/forms/template/table',
                    'style/forms/template/textArea',
                    'style/forms/template/radioOption',
                    'style/forms/template/date',
                    'style/forms/template/button',
                    'style/forms/template/uploadFile',
                    'style/forms/template/richText',
                    'style/forms/template/select',
                    'style/forms/template/checkOption',
                    'style/forms/template/dataLexi',
                    'style/forms/template/uploadImg',
                    'style/forms/template/selector',
                    'style/forms/formDevise',
                    'style/forms/dragLay',
                    'style/forms/formPreview'
                ],
                // formAreaInfo:'.formPreview',
                formAreaInfo:'html',
                temDate:'.temDate',
                uploadFileBtn:'.uploadFileBtn',
                uploadImgBtn:'.uploadImgBtn',
                richTextArea:'.richTextArea',
                selectInput:'.selectInput',
                radioOptionCont:'.radioOptionCont',
                dataLexiTree:'.dataLexiTree',
                selectorBtn:'.selectorBtn',
            },
            temQuery = new propsHandle()  // 实例化模板功能部分
        ;



        // --- 通用方法 -----





// ------start---------


        // init 模板部分渲染
        ice.loadCss(defProps.initCss);

        // 数据加载 data解析
        $.ajax({
            url:  serverPath.formPath + setter.formLinkPath +'printTemplate/get',
            type: "GET",
            contentType: 'application/json',
            dataType: 'json',
            data:{
                id:printTemplateId
            },
            success: function(result) {
                if(result.data){
                    $('#printFormPreview').html(decodeURI(decodeURIComponent(result.data)));

                    //   初始化组件事件
                    temQuery.initTemEvent(defProps,serverPath,setter);
                    form.render();
                }else{
                    layer.msg(result.msg)
                }
            }


        });


        //  init部分默认执行方法

        // 初始化模板功能
        temQuery.initTem({
            selectorBtn:defProps.selectorBtn,
            selectorTemPath:setter.views+defProps.viewMould
        });

        // 子表初始化事件
        temQuery.initSubEvent(defProps,serverPath,setter);

    })
</script>
<style>
    #LAY_app{
        overflow: auto;
    }
    .layui-layer-content{
        height: 230px;
    }
</style>
</body>
</html>